package com.i5.distributedlock.enumeration;

/**
 * @author mc0710
 * @date 2020年3月13日 下午5:32:29
 * @description 锁的实现方式
 */
public enum LockScheme {

	REDIS(LockSchemeConstant.REDIS), ZOOKEEPER(LockSchemeConstant.ZOOKEEPER);

	private String scheme;

	private LockScheme(String scheme) {
		this.scheme = scheme;
	}

	public String getScheme() {
		return this.scheme;
	}

	public static LockScheme find(String scheme) {
		for (LockScheme value : LockScheme.values()) {
			if (value.getScheme().equals(scheme)) {
				return value;
			}
		}
		return null;
	}

	public static class LockSchemeConstant {

		public static final String REDIS = "redis";

		public static final String ZOOKEEPER = "zookeeper";

	}

}
